<template>
	<view>
		<u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
		<scroll-view class="item_box" scroll-y="true" @scrolltolower='scrolltolower' v-if="items.length>0">
			<view class="sun_box" v-for="(item,i) in items" style="padding: 0 15rpx;margin-top: 15rpx;">
				<view class="sun_text">
					<view class="" style="display: flex;align-items: center;">
						<view>
							<image :src="item.avatar" mode="aspectFill"
								style="width: 120rpx;height: 120rpx;border-radius: 50%;" v-if="item.avatar"></image>
							<image src="/static/logo.png" mode="aspectFill"
								style="width: 120rpx;height: 120rpx;border-radius: 50%;" v-else></image>
						</view>
						<view class="">
							<view style="margin-left: 20rpx;font-size: 35rpx;font-weight: 600;">{{item.name}}</view>

							<view class="img_box">
								<image v-if="item.tuijain" src="/static/tuiguan.png" mode="aspectFill"></image>
								<image v-if="item.xiaoqu" src="/static/xiaoqu.png" mode="aspectFill"></image>
								<image v-if="item.quxian" src="/static/quxian.png" mode="aspectFill"></image>
							</view>
						</view>
					</view>
				</view>
				<view style="font-size: 28rpx;color: #999999;margin-right: 15rpx;">
					<view class="sun_time" style="margin-left: 20rpx;margin-top: 10rpx;text-align: right;">
						邀请{{typeName}}:{{item.numberOfPeopleInTheGroup}}人</view>
					<view style="margin-top: 15rpx;">{{item.addtime}}</view>
				</view>
			</view>
			<view class="" style="height: 200rpx;"></view>
		</scroll-view>
		<view style="width:750rpx;height: 60vh;display: flex;justify-content: center;align-items: center;" v-else>
			<view>
				<u-empty mode="list" icon="info-circle">
				</u-empty>
			</view>
		</view>
		<view class="bottom_box">
			<view style="margin-left: 20rpx;font-size: 35rpx;font-weight: 600;">
				邀请{{typeName}}:{{peopleNum}}人
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
					name: '全部'
				}, {
					name: '推广员'
				}, {
					name: '小区代理',
				}, {
					name: '区县代理',
				}],
				current: 0,
				typeName: '代理',
				items: [],
				peopleNum: 0
			}
		},
		onShow() {
			this.getInfo()
		},
		methods: {
			change(index) {
				this.current = index;

				this.getInfo()
			},
			getInfo() {
				let status = ''
				if (this.current == 0) {
					status = ''
					this.typeName = '代理'
				} else if (this.current == 1) {
					status = 0
					this.typeName = '推广员'
				} else if (this.current == 2) {
					status = 1
					this.typeName = '小区代理'
				} else {
					status = 2
					this.typeName = '区县代理'
				}
				this.$request("kehu/other/myTeam", {
					type: status
				}, 'get').then(res => {
					this.items = res.data.myTeam
					this.items.forEach(item => {
						item.params.type.forEach(item2 => {
							if (item2 == 2) {
								item.xiaoqu = true
							} else {
								item.xiaoqu = false
							}
							if (item2 == 0) {
								item.tuijain = true
							} else {
								item.tuijain = false
							}
							if (item2 == 1) {
								item.quxian = true
							} else {
								item.quxian = false
							}
						})
					})
					this.items = JSON.parse(JSON.stringify(this.items))
					this.peopleNum = res.data.numberOfPeopleInTheGroup
					console.log(this.items)
				})
			},
		}
	}
</script>

<style scoped>
	.bottom_box {
		width: 750rpx;
		background-color: #fff;
		padding-top: 20rpx;
		padding-bottom: 20rpx;
		position: fixed;
		bottom: 0%;
		background-color: #fff;
		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
	}

	.img_box {
		margin-top: 10rpx;
		margin-left: 10rpx;
	}

	.img_box image {
		border-radius: 10rpx;
		width: 90rpx;
		height: 35rpx;
		margin-right: 10rpx;
	}

	.bottom_flx {
		margin-left: 20rpx;
		margin-top: 20rpx;
		display: flex;

	}

	.bottom_title {
		font-size: 28rpx;
		font-weight: 600;
		margin-left: 20rpx;
	}

	.bottom_box {
		width: 750rpx;
		background-color: #fff;
		padding-top: 20rpx;
		padding-bottom: 20rpx;
		position: fixed;
		bottom: 0%;
		background-color: #fff;
		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
	}

	.Text1 {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 400;
		color: #fff;
		margin-right: 5rpx;
	}

	.rightIcon {
		width: 10rpx;
		height: 19rpx;
	}

	.btnBox {
		margin-left: auto;
		display: flex;
		align-items: center;
		position: absolute;
		right: 3%;
		top: 14%;
	}

	.tixian {
		color: #E87B83;
		font-size: 32rpx;
		text-align: right;
		padding-right: 30rpx;
		margin-top: 15rpx;
	}

	.sun_jifen {
		color: #0D62F1;
		font-size: 40rpx;
	}

	.sun_box {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 100%;

		margin-bottom: 50rpx;
	}

	.index_title {
		padding-left: 30rpx;
		font-size: 34rpx;
		margin-top: 10rpx;
		font-weight: bold;
		position: relative;
		margin-bottom: 30rpx;
		margin-top: 20rpx;
	}

	.sun_title {
		width: 550rpx;
		font-size: 34rpx;
		font-weight: 600;
	}

	.sun_time {
		font-size: 28rpx;
		color: #999999;
		margin-top: 26rpx;
	}


	.index_dian {
		width: 140rpx;
		height: 13rpx;
		background-color: #fe471e;
		border-radius: 7rpx;
		position: absolute;
		bottom: 0rpx;
		opacity: 0.7;
	}

	page {
		background-color: #F5F5F5;
	}

	.item_box {
		background-color: #fff;
		height: 100vh;
		border-radius: 10rpx;
	}

	.top_box {
		height: 225rpx;
		background-color: #fe471e;
		border-radius: 10rpx;
		margin-left: 20rpx;
		margin-top: 40rpx;
		display: flex;
		justify-content: space-between;
	}

	.top_text {
		color: #fff;
		font-size: 32rpx;
		text-align: center;
		width: 200rpx;
		margin-left: 20rpx;
		padding-top: 50rpx;
	}

	.top_jifen {
		font-size: 60rpx;
		font-weight: 600;
		margin-top: 25rpx;
	}
</style>